package cn.sciento.farm.devicemanager.gateway.lorawan.grpc;

import cn.sciento.farm.devicemanager.lorawan.*;

import java.util.Iterator;

/**
 * @author wumu
 * @version V1.0
 * @date 9/15/18
 * @time 7:19 PM
 */
public interface GatewayService {

    // create creates the given gateway.
    void create(CreateGatewayRequest request);

    // get returns the gateway for the requested mac address.
    GetGatewayResponse Get(GetGatewayRequest request);

    // updateById updates the gateway matching the given mac address.
    void update(UpdateGatewayRequest request);

    // delete deletes the gateway matching the given mac address.
    int delete(DeleteGatewayRequest request);

    // list lists the gateways.
    ListGatewayResponse list(ListGatewayRequest request);

    // getStats lists the gateway stats given the query parameters.
    GetGatewayStatsResponse getStats(GetGatewayStatsRequest request);

    // getLastPing returns the last emitted ping and gateways receiving this ping.
    GetLastPingResponse getLastPing(GetLastPingRequest request);

    // streamFrameLogs streams the uplink and downlink frame-logs for the given gateway ID.
    // Notes:
    //   * These are the raw LoRaWAN frames and this endpoint is intended for debugging only.
    //   * This endpoint does not work from a web-browser.
    Iterator<StreamGatewayFrameLogsResponse> streamFrameLogs(StreamGatewayFrameLogsRequest request);


}
